<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ include file="/page/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<%@ include file="/adapter/adapter-bootstrap.jsp" %>
<script type="text/javascript">
function  onLoad(){
	if(parseInt("${result}")>0){
		alert("保存成功");
	}else if(parseInt("${result}")<0){
		alert("保存失败");
	}
	
}

function  goBack(){
	window.history.back(-1);
}


function  checkfile(){
	if($("#file1").val()!=""&&$("#file2").val()!=""&&$("#file3").val()!=""&&$("#file4").val()!=""){
		document.forms[1].submit();		
	}else{
	    alert("请上传所有文件！");
	}

}

function save(){
	var str_data=$("#cerform input").map(function(){
		   return ($(this).attr("name")+'='+$(this).val());
		 }).get().join("&") ;
    $.ajax({
        url:"${ctx}/appFrameCertificate/updateAppFrameCertificate",
        type: "POST",      
        dataType:"json",
        data: str_data,
        async: false,
        success: function(data) {
        	if(data.flag>0){
	            alert("保存成功！");	
	            window.location.reload();
        	}
/* 	          $.each(data, function(index, element) {
             window.location.reload();
          }); */
        },
        error: function() {
          alert("error");
        }
      });
	
}

</script>
</head>
<body  onload="onLoad()">
<div class="panel panel-default">
   <div class="panel-heading">
      <h3 class="panel-title">
          App证书设置信息
      </h3>
   </div>
   <div class="panel-body">
<form class="form-horizontal" role="form" id="cerform"  action="${ctx}/appFrameCertificate/updateAppFrameCertificate"  method="post">
      <div class="form-group">
		<label for="APP_ID" class="col-xs-2 control-label">应用标识</label>
		<div class="col-xs-4">
		<input type="text" class="form-control" id="APP_ID" placeholder="APP_ID"  value="${appFrameCertificate.appId}"   name="appId"    readonly="readonly" >
	    </div>
	    <label for="andriod_certificate_file" class="col-xs-2 control-label">ANDRIOD证书文件</label>
		<div class="col-xs-4">
		<input type="text" class="form-control" id="andriod_certificate_file"  value="${appFrameCertificate.andriodCertificateFile}"   name="andriodCertificateFile"  readonly="readonly"  placeholder="andriod_certificate_file">
	    </div>
	  </div>
<!-- 	  <div class="form-group">
		<label for="andriod_certificate_file" class="col-xs-2 control-label">ANDRIOD证书文件</label>
		<div class="col-xs-10">
		<input type="text" class="form-control" id="andriod_certificate_file" placeholder="andriod_certificate_file">
	    </div>
	  </div> -->    
	  <div class="form-group">
		<label for="app_package_name" class="col-xs-2 control-label">应用包名</label>
		<div class="col-xs-4">
		<input type="text" class="form-control" id="app_package_name"  value="${appFrameCertificate.appPackageName}"   name="appPackageName"     placeholder="app_package_name">
	    </div>
	    <label for="app_alias_name" class="col-xs-2 control-label">别名</label>
		<div class="col-xs-4">
		<input type="text" class="form-control" id="app_alias_name"  value="${appFrameCertificate.appAliasName}"   name="appAliasName"   placeholder="app_alias_name">
	    </div>
	  </div>
	  <div class="form-group">
		<label for="certificate_lib_password" class="col-xs-2 control-label">证书库密码</label>
		<div class="col-xs-4">
		<input type="text" class="form-control" id="certificate_lib_password"  value="${appFrameCertificate.certificateLibPassword}"   name="certificateLibPassword"   placeholder="certificate_lib_password">
	    </div>
	    <label for="certificate_password" class="col-xs-2 control-label">证书密码</label>
		<div class="col-xs-4">
		<input type="text" class="form-control" id="certificate_password"  value="${appFrameCertificate.certificatePassword}"   name="certificatePassword"   placeholder="certificate_password">
	    </div>
	 </div> 
	  <div class="form-group">
		<label for="ios_certificate_file1" class="col-xs-2 control-label">IOS证书文件1</label>
		<div class="col-xs-4">
		<input type="text" class="form-control" id="ios_certificate_file1"  value="${appFrameCertificate.iosCertificateFile1}"   name="iosCertificateFile1"  readonly="readonly"  placeholder="ios_certificate_file1">
	    </div>
	    <label for="ios_certifi" class="col-xs-2 control-label">IOS证书文件2</label>
		<div class="col-xs-4">
		<input type="text" class="form-control" id="ios_certificate_file2"  value="${appFrameCertificate.iosCertificateFile2}"   name="iosCertificateFile2" readonly="readonly"   placeholder="ios_certificate_file1">
	    </div>		
	  </div>
	  	  <div class="form-group">
		<label for="ios_certificate_file1" class="col-xs-2 control-label">IOS证书文件3</label>
		<div class="col-xs-10">
		<input type="text" class="form-control" id="ios_certificate_file3"  value="${appFrameCertificate.iosCertificateFile3}"   name="iosCertificateFile3" readonly="readonly"  placeholder="ios_certificate_file1">
	    </div>		
	  </div>
	  <div class="form-group text-center">
<!--          <div class="col-xs-offset-2 col-xs-10"> -->
         <button type="button" class="btn btn-default"  onclick="save();">保存</button>
         <button type="button" class="btn btn-default"   onclick="goBack();">返回</button>
<!--          </div> -->
      </div>
</form>




<!-- <form class="form-horizontal" role="form">
                    <fieldset>
                        <legend>配置数据源</legend>
                       <div class="form-group">
                          <label class="col-xs-2 control-label" for="ds_host">主机名</label>
                          <div class="col-xs-4">
                             <input class="form-control" id="ds_host" type="text" placeholder="192.168.1.161"/>
                          </div>
                          <label class="col-xs-2 control-label" for="ds_name">数据库名</label>
                          <div class="col-xs-4">
                             <input class="form-control" id="ds_name" type="text" placeholder="msh"/>
                          </div>
                       </div>
                       <div class="form-group">
                          <label class="col-xs-2 control-label" for="ds_username">用户名</label>
                          <div class="col-xs-4">
                             <input class="form-control" id="ds_username" type="text" placeholder="root"/>
                          </div>
                          <label class="col-xs-2 control-label" for="ds_password">密码</label>
                          <div class="col-xs-4">
                             <input class="form-control" id="ds_password" type="password" placeholder="123456"/>
                          </div>
                       </div>
                    </fieldset>     
                    <fieldset>
                         <legend>选择相关表</legend>
                        <div class="form-group">
                           <label for="disabledSelect"  class="col-xs-2 control-label">表名</label>
                           <div class="col-xs-10">
                              <select id="disabledSelect" class="form-control">
                                 <option>禁止选择</option>
                                 <option>禁止选择</option>
                              </select>
                           </div>
                        </div>
                    </fieldset>
                    
                       <fieldset>
                         <legend>字段名</legend>
                        <div class="form-group">
                           <label for="disabledSelect"  class="col-xs-2 control-label">表名</label>
                           <div class="col-xs-10">
                              <select id="disabledSelect" class="form-control">
                                 <option>禁止选择</option>
                                 <option>禁止选择</option>
                              </select>
                           </div>
                        </div>
                    </fieldset>
                </form>
 -->

   </div>
</div>

<div class="panel panel-default">
   <div class="panel-heading">
      <h3 class="panel-title">
                   上传图片
      </h3>
   </div>
   <div class="panel-body">
   	   <form action="${ctx}/uploadfile/one?appid=${appFrameCertificate.appId}" method="post"  enctype="multipart/form-data">
   	   <div class="form-group">
	    <label for="file1" class="col-xs-2 control-label">android证书</label>
		<div class="col-xs-10">
		<input type="file" class="form-control" name="file1" id="file1"   placeholder="app_icon">
	    </div>
	  </div> 
	  <br><br>
	  <div class="form-group">
	    <label for="file2" class="col-xs-2 control-label">iso证书1</label>
		<div class="col-xs-10">
		<input type="file" class="form-control" name="file2" id="file2"   placeholder="app_icon">
	    </div>
	  </div>  
	  	  <br><br>
	  <div class="form-group">
	    <label for="file3" class="col-xs-2 control-label">iso证书2</label>
		<div class="col-xs-10">
		<input type="file" class="form-control" name="file3" id="file3"   placeholder="app_icon">
	    </div>
	  </div>  
	  	  <br><br>
	  <div class="form-group">
	    <label for="file4" class="col-xs-2 control-label">iso证书3</label>
		<div class="col-xs-10">
		<input type="file" class="form-control" name="file4" id="file4"   placeholder="app_icon">
	    </div>
	  </div>  
	  	  <br><br>
	   <div class="form-group  text-center">   
 	           <button type="button" class="btn btn-default"  onclick="checkfile();">上传</button>   
	        <!--    <button type="button" class="btn btn-default"  onclick="ajaxRequest();">上传</button>   -->
	   </div>
<!--          ：       <input type="file" name="uploadfile1" id>
                  上传文件：       <input type="file" name="uploadfile2"  id="icon">
           <input type="submit" value="上传"  > -->
      </form>   
   </div>
</div>

<%@ include file="/page/foot.html" %>
